package assignment;

import java.io.IOException;
import java.util.LinkedList;

import hmm.Hmm;
import static hmm.Hmm.Smoothing.*;

/**
 * This class implements the requirements of assignment Alef
 * 
 * @author Amit Yungman
 */
public class A {
	
  public static void main(String[] args) throws IOException {
  	/*Hmm test = new Hmm(	new String[]{	"corpus_for_learning.txt", 
										"corpus_for_development.txt",
										"corpus_for_evaluation.txt"},
										LAPLACE);
  	test.init();
  
  	double[][] B = test.getB();
		double[] count = new double[B.length];
		for (int i = 0; i < B.length; i++) {
			for (int j = 0; j < B[i].length; j++) {
				count[i]+=B[i][j];
				System.out.print(" "+B[i][j]+" ");
			}
			System.out.println();
		}
		System.out.println("-----------");
		for (int j = 0; j < B.length; j++) {
			System.out.print(" "+count[j]+" ");
		}
		System.out.println();
		System.out.println("-----------");*/
    Hmm hmm = new Hmm( new String[]{ "corpus_for_learning.txt", 
                      "corpus_for_development.txt",
                      "corpus_for_evaluation.txt"},
                      LAPLACE);
    hmm.init();
    
    double[] pi = hmm.getPi();
    double[][] A = hmm.getA();
    LinkedList<String> tags = hmm.getAllTags();

    System.out.print("Pi:\n\n");
    for(int i = 0; i < tags.size() ; i++)
      System.out.format("%-25s", tags.get(i));
    System.out.print("\n");
    for(int i = 0; i < tags.size() ; i++)
      System.out.format("%-25s", pi[i]);
    
    System.out.format("\n\nA:\n\n%-25s | ","");
    for(int i = 0; i < tags.size() ; i++)
      System.out.format("%-25s | ",tags.get(i));
    System.out.print("\n");
    for(int i = 0; i < tags.size() ; i++) {
      System.out.format("\n%-25s | ",tags.get(i));
      for(int j = 0 ; j < tags.size() ; j++)
        System.out.format("%-25s | ",A[i][j]);
    }
  }
}
